import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PusheVO, PusheForm, PusheQuery } from '@/api/bclt/pushe/types';

/**
 * 查询手环-消息推送列表
 * @param query
 * @returns {*}
 */

export const listPushe = (query?: PusheQuery): AxiosPromise<PusheVO[]> => {
  return request({
    url: '/bclt/pushe/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备信息（获得设备id
 */
// export const listDeviceInfo = (query?: PusheQuery): AxiosPromise<PusheVO[]> => {
//   return request({
//     url: '/bclt/deviceInfo/list',
//     method: 'get',
//     params: query
//   });
// };

/**
 * 查询手环-消息推送详细
 * @param id
 */
export const getPushe = (id: string | number): AxiosPromise<PusheVO> => {
  return request({
    url: '/bclt/pushe/' + id,
    method: 'get'
  });
};

/**
 * 新增手环-消息推送
 * @param data
 */
export const addPushe = (data: PusheForm) => {
  return request({
    url: '/bclt/pushe',
    method: 'post',
    data: data
  });
};

/**
 * 修改手环-消息推送
 * @param data
 */
export const updatePushe = (data: PusheForm) => {
  return request({
    url: '/bclt/pushe',
    method: 'put',
    data: data
  });
};

/**
 * 删除手环-消息推送
 * @param id
 */
export const delPushe = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bclt/pushe/' + id,
    method: 'delete'
  });
};
